package com.xdtech.hotel.vo;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.sql.Timestamp;

import com.xdtech.core.model.BaseItem;
import com.xdtech.core.orm.utils.BeanUtils;
import com.xdtech.hotel.model.DeviceOperation;

import com.xdtech.web.freemark.item.GridColumn;

/**
 * 
 * @author max.zheng
 * @create 2015-04-23 22:10:38
 * @since 1.0
 * @see
 */
public class DeviceOperationItem extends BaseItem implements Serializable{
	private static final long serialVersionUID = 1L;
	private Long id;
	@GridColumn(title="动作名称",width=100)
	private String name;
	@GridColumn(title="动作类型",width=100,formatter={"1=动作模式","2=场景模式"})
	private String type;
	
	private boolean selected;
	
	private Long linkageId;

	public void setId(Long id) {
		this.id = id;
	}
	public Long getId() {
		return id;
	}
	
	public void setName(String name) {
		this.name = name;
		addQuerys("name", name);
	}
	public String getName() {
		return name;
	}
	
	public void setType(String type) {
		this.type = type;
		addQuerys("type", type);
	}
	public String getType() {
		return type;
	}
	
	public Long getLinkageId() {
		return linkageId;
	}
	public void setLinkageId(Long linkageId) {
		this.linkageId = linkageId;
		addQuerys("linkageId", linkageId);
	}
	public boolean isSelected() {
		return selected;
	}
	public void setSelected(boolean selected) {
		this.selected = selected;
	}
	/**
	 * 根据model构建vo
	 * 
	 * @author max
	 * @return
	 */
	public static DeviceOperationItem createItem(DeviceOperation deviceOperation) {
		DeviceOperationItem deviceOperationItem = new DeviceOperationItem();
		BeanUtils.copyProperties(deviceOperationItem, deviceOperation);
		//自定义属性设置填充
		return deviceOperationItem;
	}
	/**
	 * 根据model集合创建vo集合
	 * 
	 * @author max
	 * @return
	 */
	public static List<DeviceOperationItem> createItems(List<DeviceOperation> deviceOperations) {
		List<DeviceOperationItem> deviceOperationItems = new ArrayList<DeviceOperationItem>();
		for (DeviceOperation deviceOperation : deviceOperations) {
			deviceOperationItems.add(createItem(deviceOperation));
		}
		return deviceOperationItems;
	}
}
